import java.util.Random;
import java.util.Scanner;

public class test3 {
    public static void main(String[] args)
    {
        Random rand = new Random();
        int guessdigit = rand.nextInt(101);

        Scanner scan = new Scanner(System.in);
        while(true)
        {
            System.out.print("请输入猜的数字：");
            int guess = scan.nextInt();
            if(guess == guessdigit){
                break;
            }
            else if(guess > guessdigit){
                System.out.println("猜大了");
            }
            else{
                System.out.println("猜小了");
            }
        }
        System.out.println("猜对了");
    }
    public static void main3(String[] args){
        Random rand = new Random(1);
        int a = rand.nextInt(100);
        System.out.println(a);
    }
    public static void main2(String[] args){
        Scanner scan = new Scanner(System.in);

/*
        while(scan.hasNextInt())
        {
            System.out.println("输入你的年龄");
            int age = scan.nextInt();
            System.out.println("年龄：" + age);
        }
*/
        while(scan.hasNextLine())
        {
            System.out.println("请输入你的姓名：");
            String name = scan.nextLine();
            System.out.println("姓名：" + name);

        }
    }
    public static void main1(String[] args) {
        Scanner scan = new Scanner(System.in);

        System.out.print("输入你的年龄：");
        int age = scan.nextInt();
        System.out.println("年龄 " + age);

        System.out.print("输入你的姓名：");
        String name = scan.next();
        System.out.println("姓名 " + name);

        scan.close();
    }
}
